﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace Steer
{
	public partial class SeekTest : UserControl
	{
        double mouseX = 0;
        double mouseY = 0;
		public SeekTest()
		{
			// Required to initialize variables
			InitializeComponent();

            Loaded += new RoutedEventHandler(SeekTest_Loaded);
		}

        void SeekTest_Loaded(object sender, RoutedEventArgs e)
        {
            //myStar.position = new Vector2D(100, 100);
            //myStar.velocity.length = 5;
            //myStar.velocity.angle = Math.PI / 4;

            MouseMove += new MouseEventHandler(SeekTest_MouseMove);
            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }

        void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            myStar.seek(new Vector2D(mouseX, mouseY));
            myStar.update();
        }

        void SeekTest_MouseMove(object sender, MouseEventArgs e)
        {
            mouseX = e.GetPosition(null).X;
            mouseY = e.GetPosition(null).Y;
        }
	}
}